package edu.bbu.license.client.android.gui.settings;

import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;
import edu.bbu.license.client.android.R;
import edu.bbu.license.client.android.controller.settings.SettingsController;
import edu.bbu.license.client.android.gui.BaseActivity;

public class SettingsActivity extends BaseActivity implements SettingsView {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.settings_activity);
		
		SettingsController.getInstance().atach(this);
	}

	@Override
	public void setAutoSyncEnable(boolean enable) {
		((CheckBox) findViewById(R.id.settings_activity_enable_sync_checkbox)).setChecked(enable);
	}
	
	@Override
	public void setAutoSyncChangeListener(OnCheckedChangeListener listner) {
		((CheckBox) findViewById(R.id.settings_activity_enable_sync_checkbox)).setOnCheckedChangeListener(listner);
	}

	@Override
	public void setOneWaySyncTypeChecked() {
		((RadioButton) findViewById(R.id.settings_activity_one_way_sync)).setChecked(true);
	}

	@Override
	public void setTwoWaySyncTypeChecked() {
		((RadioButton) findViewById(R.id.settings_activity_two_way_sync)).setChecked(true);
	}
	
	@Override
	public void setSyncTyepeChangeListener(android.widget.RadioGroup.OnCheckedChangeListener listner) {
		((RadioGroup) findViewById(R.id.settings_activity_sync_type)).setOnCheckedChangeListener(listner);
	}

	@Override
	public void setLocalSyncFolder(String folder) {
		((TextView) findViewById(R.id.settings_activity_local_sync_folder)).setText(folder);
	}

	@Override
	public void setServerSyncFolder(String folder) {
		((TextView) findViewById(R.id.settings_activity_server_sync_folder)).setText(folder);
	}
}
